import fs from "fs/promises";
import { createDatabase } from "../db/index.js";

// 读取 sql schema 文件
const sql = await fs.readFile("./sql/schema-sqlite.sql", "utf8");
const db = await createDatabase("sqlite://todolist.db");
// 执行 sql 语句
for (const s of sql.split(";")) {
  if (s.trim() === "") {
    continue;
  }
  await db.db.exec(s);
}
